import Taro, { Component } from '@tarojs/taro'
import {AtCurtain,AtButton,AtTimeline   } from 'taro-ui'
import classnames from 'classnames'
import PropsType from 'prop-types'
import { View,Image} from '@tarojs/components'
import '../styles/curtain.scss'
const yellowH = require('../../../pages/assets/yellowH.png')
const right = require('../../../pages/assets/rightarrow.png')
const itemBgNone = require('../assete/none_Tran_info.png')
export default class DCurtain extends Component {

    onClose() {
        this.props.onClose && this.props.onClose()
    }
  

    render() {
      const {
        className,
        isCurtain,
        adstart,
        adend,
        curItem=[
            // { title: '刷牙洗脸', color: 'yellow',date:'2019-12-27',time:'11:48' }, 
            // { title: '吃早餐', color: 'yellow',date:'2019-12-27',time:'11:48'  }, 
            // { title: '上班', color: 'yellow',date:'2019-12-27',time:'11:48'  }, 
            // { title: '睡觉做梦', color: 'yellow',date:'2019-12-27',time:'11:48' }
          ]
      } = this.props
        return (
          <View className={classnames('b_curtain', className)}>
             <AtCurtain
                isOpened={isCurtain}
                onClose={this.onClose.bind(this)}
              >
              <View className='b_curtain__box'>
                <View className='b_curtain__header'>
                  <View className='b_curtain__header_text'>物流信息</View>
                  <Image src={yellowH} className='b_curtain__headerimg'></Image>
                </View>
              
               {  curItem.length !== 0  &&
               <View  className='b_curtain__content'>
                  <View  className='b_curtain__content_top'>
                    <View >
                      <View className='item_text'>始发地</View>
                      <View className='item_font'>{adstart}</View>
                    </View>
                    <View>
                      <Image src={right} className='b_curtain__content_img'></Image>
                    </View>
                    <View>
                      <View className='item_text'>目的地</View>
                      <View className='item_font'>{adend}</View>
                    </View>
                  </View>
                  <View className='b_curtain__content_time'>
                    <View className='b_curtain__content_time_left'>
                      {
                          curItem.map((item,i)=>{
                          return <View className='item_time' key={i}>
                                    <View className='item_first'>{item.date}</View>
                                    <View >{item.time}</View>
                                  </View>
                        })
                      }
                    </View>
                    <View className='b_curtain__content_time_right'>
                      <AtTimeline 
                        pending
                        items={curItem}
                      >
                      </AtTimeline>
                    </View>
                  </View>
                </View>}

               { curItem.length === 0 &&
                <View  className='b_curtain__content'>
                  <Image src={itemBgNone} className='b_curtain__bg'></Image>
                  <View className='b_curtain__bg_text'>资金方尚未更新物流信息，请耐心等候</View>
                </View>}

              </View>
            </AtCurtain>
          </View>
         
        )
    }
}

DCurtain.defaultProps = {
    className: '',
    isCurtain:false,
    adstart:'广州',
    adend:'北京',
    onClose: () => { },
}
DCurtain.PropsType = {
    className: PropsType.oneOfType[PropsType.string, PropsType.object],
    isCurtain:PropsType.bool,
    title: PropsType.string,
    adstart: PropsType.string,
    adend: PropsType.string,
    firstbtn: PropsType.string,
    lastbtn: PropsType.string,
    onClose: PropsType.func,
}